<?php
$datetimeFormat = Configure::read('Setting.datetime_format');
echo $this->Form->create('Test', array('inputDefaults' => array('div' => false, 'label' => false)));
echo $this->element('backend/grid_bar', array('jsObject' => 'testGrid'));
?>
<table class="table table-bordered table-stripped">
    <thead>
        <tr>
            <th width="10">&nbsp;</th>
            <th width="5">&nbsp;</th>
            <th><?php echo __('Examinee') ?></th>
            <th width="20%"><?php echo __('Exam Name') ?></th>
            <th width="110"><?php echo __('Question No') ?></th>
            <th width="20%"><?php echo __('Start time') ?></th>
            <th width="20%"><?php echo __('End time') ?></th>
        </tr>
    </thead>
    <tbody>
        <?php
        $paging = $this->Paginator->params();
        if (isset($paging['page']) && isset($paging['limit'])) {
            $startPosition = ($paging['page'] - 1) * $paging['limit'];
        } else {
            $startPosition = 0;
        }
        foreach ($tests as $k => $test):
        ?>
        <tr>
            <td><?php echo $startPosition + $k + 1 ?></td>
            <td width="20" class="center"><?php echo $this->Form->checkbox('rowcheckbox', array('class' => 'row-checkbox', 'value' => $test['Test']['id'])) ?></td>
            <td><?php echo $test['Examinee']['fullname'] ?></td>
            <td><?php echo $test['Exam']['name'] ?></td>
            <td><?php echo $test['Test']['done_question_number'] ?></td>
            <td><?php echo date($datetimeFormat, $test['Test']['start_time']) ?></td>
            <td><?php echo date($datetimeFormat, $test['Test']['end_time']) ?></td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php echo $this->Form->end() ?>